#include "department_info.h"
#include "ui_department_info.h"
#include <QDebug>
#include <QMessageBox>

extern QString home;
extern QString home_number;
extern QString department;
extern QString wnumber;

Department_Info::Department_Info(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Department_Info)
{
    ui->setupUi(this);

    ui->home_number->setText(wnumber);

}

Department_Info::~Department_Info()
{
    delete ui;
}

void Department_Info::on_save_clicked()
{

    QString name = ui->name->text();
    QString number = ui->number->text();
    QString story = ui->story->text();
    QString tel = ui->tel->text();
    QString _extern = ui->_extern->text();

    if(SqlModel::insert_department(wnumber,name,number,story,tel,_extern))
    {
        qDebug()<<"yes";
    }

    QMessageBox::warning(this,"tips","add success");
    this->close();


}

void Department_Info::on_quit_clicked()
{
    this->close();
}
